import { createRouter, createWebHistory } from "vue-router";
import ProjDetail from "../views/ProjDetail.vue";

const LoginPage = () => import("../views/LoginPage.vue");
const DashboardView = () => import("../views/DashboardView.vue");
const UserDetail = () => import("../views/ProjDetail.vue");
const UserProfile = () => import("../views/UserProfile.vue");

const RegisterPage = () => import("../views/RegisterPage.vue");

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/login",
      component: LoginPage,
    },
    {
      path: "/register",
      name: "register",
      component: RegisterPage,
    },
    {
      path: "/dashboard",
      name: "dashboard",
      component: DashboardView,
      meta: { requiresAuth: true },
    },
    {
      path: "/user/:id",
      component: UserDetail,
      meta: { requiresAuth: true },
    },
    {
      path: "/profile",
      component: UserProfile,
      meta: { requiresAuth: true },
    },
    {
      path: "/projdetail",
      component: ProjDetail
    }
  ],
});

export default router;
